﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Pku.BookStore.IServices;
using Pku.BookStore.Model;

namespace Pku.BookStore.Services
{
    [Serializable]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode.Multiple)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class PublisherServices : IPublisherServices
    {
        /// <summary>
        /// 获取实例名
        /// </summary>
        private DAL.PublisherDAL publisherDAL
        {
            get
            {
                return new DAL.PublisherDAL();
            }
        }

        /// <summary>
        /// 增加出版社
        /// </summary>
        /// <param name="entity"></param>
        public int Add(PublisherModel entity)
        {
            return publisherDAL.Add(entity);
        }

        /// <summary>
        /// 修改出版社信息
        /// </summary>
        /// <param name="entity"></param>
        public bool Modify(PublisherModel entity)
        {
            return publisherDAL.Modify(entity);
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public List<PublisherModel> Search(PublisherParam param)
        {
            return publisherDAL.Search(param);
        }

        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="publisherID"></param>
        /// <returns></returns>
        public PublisherModel GetEntityById(int publisherID)
        {
            return publisherDAL.GetEntityById(publisherID);
        }

        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="Str">关键字</param>
        /// <returns></returns>
        public bool Exist(string Str)
        {
            return publisherDAL.Exist(Str);
        }

        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public int GetCount(Model.PublisherParam param)
        {
            return publisherDAL.GetCount(param);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="CategoryID"></param>
        /// <returns></returns>
        public bool Delete(int PublisherID)
        {
            return publisherDAL.Delete(PublisherID);
        }
    }
}
